import time

from NanNing.common import RadarTEST, UdpClient

# TTT1111 SFL=8100  height 8000  qnh=1008
SSRdatHex1 = '0103300044edfd018016b88c5ba5e00801041a01e240514531c71c4003b3e000304000004087101717a2047950a0090f6d0004006003e709a417500058400030000408000000'
# TTT1111 SFL=8100  height 8244  qnh=1008
SSRdatHex2 = '0103300044edfd018016b88c5ba5e00801043a01e240514531c71c4003b3e000304000004087101717a2047950a0090f6d0004006003e709a417500058400030000408000000'

if __name__ == '__main__':
    tag = 0
    while True:
        tag += 1
        if tag < 5001:  # 发5000次数据
            if tag % 32 == 0:  # 每32秒
                if tag % 4 == 0:
                    print(f"-----------------------------------------\n"
                          f"send asdb1 data SSRdatHex2")
                    with UdpClient() as client:
                        client.connect(RadarTEST.HOST, RadarTEST.PORT2)
                        client.set_data(SSRdatHex2)
                        client.main_send()
                        time.sleep(1)
            elif tag % 4 == 0:
                print(f"-----------------------------------------\n"
                      f"send asdb1 data SSRdatHex1")
                with UdpClient() as client:
                    client.connect(RadarTEST.HOST, RadarTEST.PORT2)
                    client.set_data(SSRdatHex2)
                    client.main_send()
                    time.sleep(1)
        else:
            break
